package com.leetcode.专项突破.排序算法全解析;

/**
 * @author 覃国强
 * @date 2022-03-03 20:02
 */
public class A03_插入排序 {


  public static void insertSort(int[] nums) {
    for (int i = 1; i < nums.length; ++i) {
      int curNum = nums[i];
      int j = i - 1;
      while (j >= 0 && nums[j] > curNum) {
        nums[j + 1] = nums[j];
        --j;
      }
      nums[j + 1] = curNum;
    }
  }

}
